<div class="main_bd">

    <div class="panel panel_overview">
        <div class="panel__hd">
            <h3 class="panel__title">关键词竞价</h3></div>
        <div class="panel__bd">

            <form class="form" action="/spread/doBuy" enctype="multipart/form-data" method="post">

                <div class="form_group">
                    <label style="line-height: 32px;width: 80px;">竞价关键词</label>
                    <input class="form-control" readonly name="word" value="{$word}" >
                </div>
                <div class="form_group">
                    <label style="line-height: 32px;width: 80px;">公司编号</label>
                    <input class="form-control" readonly name="user_id" value="{$company.user_id}" >
                </div>
                <div class="form_group">
                    <label style="line-height: 32px;width: 80px;">公司名称</label>
                    <input class="form-control  len" readonly name="company" value="{$company.company}" >
                </div>
                <div class="form_group">
                <label style="line-height: 32px;width: 80px;">竞价</label>
                <input class="form-control len" required name="price" type="number" min="{$min}" placeholder="{$min}" ><small class="padding10-c">不得低于{$min}元，价格越高最终排名越高</small>
            </div>
                <div class="form_group">
                    <label style="line-height: 32px;width: 80px;">开始时间</label>
                    <input class="form-control layer-date" style="width:360px;" required name="totime"
                           placeholder="YYYY-MM-DD"
                           onclick="laydate({istime: true, format: 'YYYY-MM-DD'})">
                </div>
                <div class="form_group">
                    <label style="line-height: 32px;width: 80px;">购买时长</label>
                    <select required name="month">
                        <option value="1">1个月</option>
                        <option value="2">2个月</option>
                        <option value="3">3个月</option>
                        <option value="6">6个月</option>
                        <option value="12">12个月</option>
                        <option value="24">24个月</option>
                    </select>

                </div>
                <button class="btn btn_primary">提交审核</button>
            </form>


        </div>
    </div>
</div>
<script>


    $(function() {
        $("input[name='image_src']").on("change", function () {

            var objUrl = getObjectURL(this.files[0]); //获取图片的路径，该路径不是图片在本地的路径
            if (objUrl) {
                var tempStr = "<img class='thumb' width='200px' style='max-height:200px'  />",
                    $label = $('#pic_box');
                $label.find('img.thumb').remove()
                $label.append(tempStr);
                $label.find('img.thumb').attr('src', objUrl);

            }
        });

    });

    function getObjectURL(file) {
        var url = null ;
        if (window.createObjectURL!=undefined) { // basic
            url = window.createObjectURL(file) ;
        } else if (window.URL!=undefined) { // mozilla(firefox)
            url = window.URL.createObjectURL(file) ;
        } else if (window.webkitURL!=undefined) { // webkit or chrome
            url = window.webkitURL.createObjectURL(file) ;
        }
        return url ;
    }



    function getStatus(status) {
        if (status == 3) return '已上架'
        if (status == 0) return '未上架'
        return '状态异常';//万一还有其他的呢
    }

    function taggleSatus(id, status) {
        var action = 'up';

        if (status == 0) {
            action = 'down'
        }
        $.post('/mall/' + action, {id: id}, function (res) {
            if (res.code == 1) {
                layer.msg('切换成功');
                grid.draw();

            }
        })
    }

</script>